﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Emgu.CV;
using Emgu.CV.Structure;
using Emgu.Util;
using Emgu.CV.UI;
using System.Diagnostics;

namespace CCD
{
    public partial class AddBlockDialog : Form
    {
        public AddBlockDialog(string modelname)
        {
            InitializeComponent();
            ModelName = modelname;
        }

        private void AddBlock_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Length == 0)
                MessageBox.Show("Block name can't be empty!");
            else
            {
                this.Close();

                ModelAndBlockManager father = (ModelAndBlockManager)this.Owner;
                father.AddBlock(ModelName, textBox1.Text);
            }
        }

        private void EnterForm(object sender, EventArgs e)
        {
            this.textBox1.Focus();
        }

        private void EnterPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
                AddBlock_Click(sender, e);
        }
    }
}
